<%@ page import ="com.puneMovies.data.Movie,com.puneMovies.data.Theater,com.puneMovies.data.TimeSlot" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>


        <tr>
          <td colspan="3"> 
		  
		  
		  
		  <div align="center" class="boldtext style7"><strong>Display Movies </strong></div>
		  
		  
		  
		  
		  </td>
          </tr>
		  		  
		  <tr>
          <td colspan="3"> 
		 <c:forEach items="${requestScope.theaterArr}" var="theater"> 
		 <table>
		 <c:if test="${!empty requestScope.timeslotMap[theater.theaterId]}" >		 
          <tr height="10%">
          <td width="10%" class="boldtext style7">Theater Name</td>	
		  	  
		 <c:set var="timeSlotArr"  value="${requestScope.timeslotMap[theater.theaterId]}"  /> 	
		 <c:forEach var="timeSlot"  items="${timeSlotArr}" >	  
          <td width="10%" class="boldtext style9">Movie name </td>
          <td width="10%" class="boldtext style9">TimeSlot </td>		  
		  </c:forEach>
        </tr>

        <tr>
          <td height="32"><c:out value="${theater.theaterName}" /></td>
		 <c:forEach var="timeSlot"  items="${timeSlotArr}" >	   		  
		 <%
		 
		 TimeSlot timeSlot=(TimeSlot)pageContext.findAttribute("timeSlot");
		 Theater theater=(Theater)pageContext.findAttribute("theater");
		 String movieKey =theater.getTheaterId()+":"+timeSlot.getTimeSlotId();
		  request.setAttribute("movieKey",movieKey);
		  System.out.println("  movieKey  "+movieKey);
		 %>
		 <c:set var="movie" value="${requestScope.movieMap[requestScope.movieKey]}" />
          <td><a href="#" 
		   <c:if test ="${!empty movie.movieId }" >
		   onMouseover="ddrivetip('img<c:out value="${movie.movieId}" />')";
           onMouseout="hideddrivetip()" 
			 </c:if>
			 
			 
			 ><c:out value="${movie.movieName}"/></a></td>
		  <c:set var="showingTime" value="" />
		  <c:choose>
		    <c:when test="${empty movie.actualTime}" >
			 <c:set var="showingTime" value="${timeSlot.usualTime}" />
			</c:when>
			<c:otherwise>
			<c:set var="showingTime" value="${movie.actualTime}" />
			</c:otherwise>
		  </c:choose>
          <td><c:out value="${showingTime}" /></td>          
		  </c:forEach>
          </tr>		
		</c:if>		
		 <tr>
          <td height="32" colspan="3"><div align="center"></div></td>
        </tr>
		</table>
		</c:forEach>		
		
<div id="theaterElements" style="display:block;visibility:hidden">
	<table>
	<tr>
	<td >
	   <c:forEach var="mapEntry"  items="${requestScope.descMap}" >	  
		   <div id="img<c:out value="${mapEntry.key}" />Text">
		      <c:out value="${mapEntry.value}" />
			</div>	    
		</c:forEach>
	</td>
	</tr>	
	</table>
</div>

<div id="theaterHeaders" style="display:block;visibility:hidden">
	<table>
	<tr>
	<td >
	   <c:forEach var="mapEntry"  items="${requestScope.namesMap}" >	  
		   <div id="img<c:out value="${mapEntry.key}" />Title">
		      <c:out value="${mapEntry.value}" />
			</div>	    
		</c:forEach>
	</td>
	</tr>	
	</table>
</div>
		</td>
		</tr>
       